﻿<!doctype html>
<html>
<head>
    <title>SpreadJS - 1040 Tax Form</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <link href="../../../external/spreadjs/css/gcspread.sheets.excel2013white.9.40.20161.0.css" rel="stylesheet" type="text/css" />

    <script src="../../../external/external/jquery-1.8.2.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="../../../external/spreadjs/gcspread.sheets.all.9.40.20161.0.min.js"></script>

    <script id="scriptInit" type="text/javascript">
        /*code_begin*/
        $(document).ready(function () {
            var spread = new GcSpread.Sheets.Spread(document.getElementById("ss"), { sheetCount: 1 });
            initSpread(spread);
        });

        function initSpread(spread) {
            $.ajax({
                url: "taxform_json.txt",
                datatype: "text",
                beforeSend: function (xhr) {
                },
                success: function (data) {
                        try {
                            var sd = JSON.parse(data);
                            if (sd.length > 0) {
                                if (!spread) {
                                    return;
                                }
                                spread.isPaintSuspended(true);
                                spread.fromJSON(sd[0]);
                                spread.tabStripVisible(false);

                                var sheet = spread.getSheet(0);
                                sheet.setGridlineOptions({ showHorizontalGridline: false, showVerticalGridline: false });
                                sheet.getColumns(0, sheet.getColumnCount(GcSpread.Sheets.SheetArea.rowHeader) - 1, GcSpread.Sheets.SheetArea.rowHeader).visible(false);
                                sheet.getRows(0, sheet.getRowCount(GcSpread.Sheets.SheetArea.colHeader) - 1, GcSpread.Sheets.SheetArea.colHeader).visible(false);

                                var style = sheet.getStyle(1, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(1, 1, style);
                                }

                                style = sheet.getStyle(3, 3, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(3, 3, style);
                                }

                                style = sheet.getStyle(7, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(7, 1, style);
                                }

                                style = sheet.getStyle(5, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(5, 1, style);
                                }

                                style = sheet.getStyle(9, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(9, 1, style);
                                }

                                style = sheet.getStyle(15, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(15, 1, style);
                                    sheet.setStyle(21, 1, style);
                                }

                                style = sheet.getStyle(31, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(31, 1, style);
                                }

                                style = sheet.getStyle(37, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(37, 1, style);
                                }

                                style = sheet.getStyle(41, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(41, 1, style);
                                }

                                style = sheet.getStyle(46, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(46, 1, style);
                                }

                                style = sheet.getStyle(17, 22, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(17, 22, style);
                                }

                                style = sheet.getStyle(19, 12, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(19, 12, style);
                                    sheet.setStyle(19, 16, style);
                                    sheet.setStyle(19, 18, style);
                                }

                                style = sheet.getStyle(8, 21, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(8, 21, style);
                                }

                                style = sheet.getStyle(10, 21, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.wordWrap = true;
                                    sheet.setStyle(10, 21, style);
                                }

                                style = sheet.getStyle(13, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.font = "normal bold 14px Calibri";
                                    sheet.setStyle(13, 1, style);
                                    sheet.setStyle(17, 1, style);
                                    sheet.setStyle(28, 1, style);
                                }

                                style = sheet.getStyle(46, 1, GcSpread.Sheets.SheetArea.viewport);
                                if (style) {
                                    style.font = "normal bold 14px Calibri";
                                    style.wordWrap = true;
                                    sheet.setStyle(46, 1, style);
                                }

                                spread.isPaintSuspended(false);
                            }
                        } catch (ex) {
                        }
                },
                error: function (ex) {
                    alert(ex);
                }
            });
        }
        /*code_end*/
    </script>

</head>
<body>
    <div class="sample-turtorial">
        <div id="ss" style="width: 100%; height: 620px; border: 1px solid gray;"></div>
    </div>
</body>
</html>
